<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      >

    <body>

        <ui:composition template="./../template.xhtml">
            <ui:define name="meta">
                <c:if test="${user != null}">
                    <c:if test="${user.isAdmin == false}">
                        <meta http-equiv="refresh" content="0; URL=#{facesContext.externalContext.requestContextPath}/faces/403error.xhtml" />
                    </c:if>
                </c:if>
                <c:if test="${user == null}">
                    <meta http-equiv="refresh" content="0; URL=#{facesContext.externalContext.requestContextPath}/faces/login.xhtml" />
                </c:if>
            </ui:define>
            <ui:define name="title">
                Participate Event
            </ui:define>

            <ui:define name="content">
                <f:view>
                    <h:form>
                        <h:outputText escape="false" value="(Don't have request participate)" rendered="#{eventController.items.rowCount == 0}"/>
                        <p:panel header="List Participate Events">
                            <p:dataTable value="#{eventController.itemsEventReg}" var="item"

                                         paginator="true" rows="10"
                                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                         rowsPerPageTemplate="5,10,15"
                                         style="font-size: 12px;"
                                         >
                                <p:column style="width: 120px;" sortBy="#{item.eventName}" filterBy="#{item.eventName}">
                                    <f:facet name="header">
                                        <h:outputText escape="false" value="Event&lt;br/&gt;Name"/>
                                    </f:facet>
                                    <h:outputText value="#{item.eventName}" />
                                </p:column>
                                <p:column style="width: 90px;">
                                    <f:facet name="header">
                                        <h:outputText escape="false" value="Event&lt;br/&gt;Time"/>
                                    </f:facet>
                                    <h:outputText value="#{item.startEvent}">
                                        <f:convertDateTime pattern="MM/dd/yyyy" />
                                    </h:outputText>
                                    <h:outputText value=" - " />
                                    <h:outputText value="#{item.finishEvent}">
                                        <f:convertDateTime pattern="MM/dd/yyyy" />
                                    </h:outputText>
                                </p:column>
                                <p:column style="width: 120px;">
                                    <f:facet name="header">
                                        <h:outputText escape="false" value="Registration&lt;br/&gt;Time"/>
                                    </f:facet>
                                    <h:outputText value="#{item.startReg}">
                                        <f:convertDateTime pattern="MM/dd/yyyy" />
                                    </h:outputText>
                                    <h:outputText value=" - " />
                                    <h:outputText value="#{item.endReg}">
                                        <f:convertDateTime pattern="MM/dd/yyyy" />
                                    </h:outputText>
                                </p:column>
                                <p:column style="width: 90px;">
                                    <f:facet name="header">
                                        <h:outputText escape="false" value="Max&lt;br/&gt;Player"/>
                                    </f:facet>

                                    <h:outputText value="#{item.maxPlayer}"/>
                                </p:column>
                                <p:column style="width: 90px;">
                                    <f:facet name="header">
                                        <h:outputText value="Reg Player"/>
                                    </f:facet>
                                    <h:outputText value="#{item.registrationCollection.size()}"/>
                                </p:column>
                                <p:column style="width: 90px;">
                                    <f:facet name="header">
                                        <h:outputText value="View"/>
                                    </f:facet>
                                    <p:commandButton ajax="false" action="#{registrationController.prepareViewParticipateEvt(item)}" value="View"/>
                                </p:column>
                            </p:dataTable>
                        </p:panel>
                    </h:form>

                </f:view>
            </ui:define>

        </ui:composition>

    </body>
</html>
